﻿using System.Collections.Generic;
using XUCore.Extensions;
using XUCore.Files;
using FileInfo = XUCore.Files.FileInfo;

namespace XUCore.NetCore.Uploads
{
    public class ImageFileInfo : FileInfo
    {
        public ImageFileInfo(string path, long? size, string fileName = null, string id = null)
            : base(path, size, fileName, id)
        {
        }
        /// <summary>
        /// 图片宽度
        /// </summary>
        public int Width { get; internal set; }

        /// <summary>
        /// 图片高度
        /// </summary>
        public int Height { get; internal set; }

        public Dictionary<string, string> Thumbs { get; set; } = new Dictionary<string, string>();

        /// <summary>
        /// 重新写入文件大小（当原图被裁剪，大小变化）
        /// </summary>
        /// <param name="size"></param>
        public void UpdateSize(long? size)
        {
            base.Size = new FileSize(size.SafeValue());
        }
    }
}